<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String type = request.getParameter("type") == null?"radio":request.getParameter("type");
%>
<!-- <jsp:include page="../../import.jsp" flush="true" /> -->
<link rel="StyleSheet" href="<%=path%>/lib/dtree/dtree.css" type="text/css" />
<script type="text/javascript" src="<%=path%>/lib/dtree/dtree.js"></script>
<style>
/*height:240;overflow:scroll;*/
.roleTreeCss{width:200px;}
.roleTreeCss img{border:0;}
</style>
<SCRIPT LANGUAGE="JavaScript">
var rolePageCache = {};
var formatRoleName = function(rid){
	if(rid==null||rid=='null') return '';
	var rids = rid.replace(/;/g,'|').split('|');
	var tmp = [];
	for(var i=0;i<rids.length;i++){
		if(rolePageCache[rids[i]]!=null)
			tmp.push(rolePageCache[rids[i]].NAME);
		else
			tmp.push(rids[i]);
	}
	return tmp.join(';');
}
</SCRIPT>
<div style="roleTreeCss">
	<div class="dtree">
		<SCRIPT LANGUAGE="JavaScript">
			queryDB({index:'quaryRoles',order:'pid'},function(result){
				mytree = new dTree('mytree');
				if('<%=type%>' == 'radio')
					mytree.config.useRadio = true; 
				else
					mytree.config.useCheckbox = true;
				for(var each in result){
					var rb = result[each];
					rolePageCache[rb["ID"]] = rb;		
					mytree.add(rb["ID"],rb["PID"],rb["NAME"],'#',rb["INFO"]);
				}
				document.write(mytree);
			},false);	
		</SCRIPT>
	</div>
</div>



